package com.wuxf.service;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wuxf.entity.TicketInfo;
import com.wuxf.mapper.custom.TicketMapper;
import com.wuxf.util.DateUtils;

@Service
@SuppressWarnings({"rawtypes","unchecked"})
public class TicketService {
	@Autowired
	private TicketMapper ticketMapper;
	
	
	public TicketInfo findResidueTicketNum(int userId,String ticketType) {
		HashMap paraMap = new HashMap();
		paraMap.put("userId", userId);
		paraMap.put("ticketType", ticketType);
		return ticketMapper.findByMap(paraMap).get(0);
	}
	
	public TicketInfo updateTicket(TicketInfo ticketInfo) {
		ticketInfo.setUpdateTime(DateUtils.getNowDate());
		ticketMapper.updateTicket(ticketInfo);
		return ticketInfo;
	}
}
